<template>
    <div class="preWorkBox">
      <!-- 产品SN换绑 -->
      <div class="content">
        <div class="contentDiv">
         
          <el-form
          ref="form"
          class="perForm"
          :model="form"
          label-width="120px"
          size="medium"
          style="margin-top: 15px;"
        >
          <el-form-item label="旧SN码" prop="oldSN">
            <el-input
              v-model="form.oldSN"
              type="textarea"
              placeholder="输入SN码"
              :autosize="{ minRows: 2, maxRows: 5 }"
              style="width: 400px;height:50px;"
            />
          </el-form-item>
          <el-form-item label="新SN码" prop="newSN">
            <el-input
              v-model="form.newSN"
              type="textarea"
              placeholder="输入SN码"
              :autosize="{ minRows: 2, maxRows: 5 }"
              style="width: 400px;height:50px;"
            />
          </el-form-item>
        </el-form>

        </div>
      </div>
      <div class="dialog_footer">
        <el-button type="primary" style="font-size: 24px;" @click="submitForm">提 交</el-button>
      </div>
    </div>
  </template>
      
    <script>
  // failsafeList  13008
  import { getAlllist, getResult,changeBinding} from "@/api/apppro/index";
  export default {
    name: "selfInspection",
    props: {
      formObj: Object
    },
    data() {
      return {
        form: {},
        loading: false,
        templateList: []
      };
    },
  
    created() {
      // this.getCode();
      this.getList();
    },
    methods: {
      getList() {
        this.loading = true;
        let params = {};
        params.productId = this.formObj.productId;
   //     params.productType = this.formObj.productType;
        params.processId = this.formObj.processId;
   //     params.processCode = this.formObj.processCode;
   //     params.productCode = this.formObj.productCode;
        console.log(this.formObj, "===== this.formObj=====");
        getAlllist(params).then(response => {
          this.loading = false;
          this.templateList = response;
        });
      },
  
      submitForm() {
        let params={
          oldSnCode:this.form.oldSN,
          newSnCode:this.form.newSN
        }
        console.log(params,'params');
        changeBinding(params).then(res => {
          console.log(res, "=======res=======");
          this.$modal.msgSuccess(res.msg);
          if(res.code == 200){
            this.form={}
          }
        });
      }
    }
  };
  </script>
    <style rel="stylesheet/scss" lang="scss" scoped>
  .perForm ::v-deep .el-form-item__label {
    font-size: 28px;
  }
  
  .contentDiv ::v-deep .el-alert__title {
    font-size: 20px;
  }
  .contentDiv ::v-deep .el-alert__icon {
    font-size: 20px;
  }
  .content {
    // margin-top: 20px;
    // text-align: center;
    display: flex;
    justify-content: center;
    // width: 100%;
  }
  
  .dialog_footer {
    width: 100%;
    text-align: center;
    margin-top: 20px;
    // display: flex;
    // justify-content: center;
  }
  
  .sn_box {
    text-align: left;
    margin-left: 10%;
    font-size: 20px;
    line-height: 40px;
  }
  </style>
      